|
|
 |
|
|
|
|
' Add the second control's text with RTF codes. rchOutput(1).SelStart = Len(rchOutput(1).Text)
rchOutput(1).SelLength = 0
rchOutput(1).SelRTF = rchInput(1).SelRTF
' Restore the SetStart and SelLength values. For i = 0 To 1
rchInput(i).SelStart = sel_start(i)
rchInput(i).SelLength = sel_length(i)
Next i
rchOutput(1).SelLength = 0
End Sub |
|
|
|
|
|
|
|
|
Example program RichEdit, shown in Figure 4.13, uses a rich text box to build a simple but powerful text editor. |
|
|
|
|
|
|
|
|
Program RichEdit provides menu commands that give access to many of the rich text box's features. When the user selects one of these commands, the program toggles the value of the corresponding rich text box property. For example, the following code shows how the program toggles the bold status of the selected text when the user invokes the Bold menu item. Similar event handlers handle the program's other menu items. |
|
|
|
 |
|
|
|
|
Private Sub mnuFontBold_Click()
rchText.SelBold = Not rchText.SelBold
rchText_SelChange
End Sub |
|
|
|
|
|
|
|
|
Figure 4.13
Example program RichEdit uses the Rich text box control to build a text editor. |
|
|
|
|
|